package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum Status {
	
	ACTIVE(0,"有效"),
	INACTIVE(1,"失效");
	
	private Integer status;
	
	private String value;

	private Status(Integer status,String value){
		this.status = status;
		this.value = value;
	}

	public int toIntStatus() {
		return this.status;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static Status toFlag(int status) {
		if (INACTIVE.status == status) {
			return INACTIVE;
		} else if (ACTIVE.status == status) {
			return ACTIVE;
		} else {
			throw new InvalidArgumentException("Unknown status[" + status + "].");
		}
	}
}
